package com.wavehi.jdk;

import org.springframework.beans.factory.annotation.Autowired;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Author WaveHi
 * @Date 18/10/2021 上午 10:27
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description
 */
public class JDKInvocationHandler implements InvocationHandler {
    private Object obj;

    public Object getObj() {
        return obj;
    }

    public void setObj(Object obj) {
        this.obj = obj;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("JDK dynamic proxy!");
        return method.invoke(obj, args);
    }
}
